package ch.hearc.coursJava.exa3;

import static junit.framework.Assert.assertTrue;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class AdditionTest
	{

	/*------------------------------------------------------------------*\
	 |*							Constructeurs							*|
	 \*------------------------------------------------------------------*/

	@Before
	public void before()
		{
		// rien
		}

	@After
	public void after()
		{
		// rien
		}

	/*------------------------------------------------------------------*\
	 |*							Methodes Public							*|
	 \*-----------------------------------------------------------------*/

	@Test
	public void testXXX()
		{
		int[] tab1 = new int[]{1,2,3,4,5};
		int[] tab2 = new int[]{10,11,12,13,14};
		int[] tabResTheorique = new int[]{11,13,15,17,19};

		int[] tabRes = Addition.additionner(tab1, tab2);

		assertTrue(isEgal(tabRes, tabResTheorique));
		}

	/*------------------------------------------------------------------*\
	|*							Methodes Private						*|
	\*------------------------------------------------------------------*/

	private boolean isEgal(int[] tab1, int[] tab2)
		{
		assertTrue(tab1.length == tab2.length);

		for(int i = 0; i < tab1.length; i++)
			{
			if(tab1[i] != tab2[i])
				{
				return false;
				}
			}
		return true;
		}
	}


